<template>
    <div>
        <div class="whiteBg" @click="hide">
            <div class="padding_common">
                <!-- 轮播图 -->
                <slide-img :divStyle="0" :bannerArry='banner'></slide-img>
            </div>
            <div class="coupon_dtl_tab">
                <p :class="{hot:indexTab == 0}" @click="tabSwitch(0)"><span>套餐详情</span></p>
                <p :class="{hot:indexTab == 1}" @click="tabSwitch(1)"><span>商家信息</span></p>
            </div>
        </div>
        <div class="couponDtlTab1" v-show="indexTab == 0 ">
            <div class="whiteBg" @click="hide">
                <div class="coupon_dtl_coupon">
                    <div class="yun_price">
                        <span>{{couponParam.valuation || '0'}}</span>芸券
                    </div>
                    <div class="couponDiv">
                      <coupon-denomination :item="couponParam"></coupon-denomination>
                    </div>
                    <div class="card_info">
                        <div class="card_name">
                            {{couponParam.couponName}}
                        </div>
                        <div class="coupon_info_item">
                            <star :couponComScore="couponParam.comScore"></star>
                            <p class="info_pad">{{couponParam.comNum || 0}}条 &nbsp;&nbsp;&nbsp;&nbsp;剩余{{couponParam.sellNum || 0}}张</p>
                        </div>
                        <div class="clear"></div>
                        <div class="coupon_info_item color_gray">
                            <div class="left" v-if="couponParam.usrId">
                                <div class="coupon_dtl_avatar"><img :src="couponParam.usrPicUrl"></div>
                                {{couponParam.usrName}}
                            </div>
                            <span :class="{right:couponParam.usrId}">已售出  &nbsp;&nbsp;{{couponParam.soldnum}}  &nbsp;已使用  &nbsp;&nbsp;{{couponParam.usednum}}</span>
                        </div>
                    </div>
                </div>
                <div class="coupon_dtl_tit">使用须知</div>
                <div class="coupon_dtl_instr">
                    <ul>
                        <li v-if="scpoe"><span>{{scpoe + extra}}</span></li>
                        <li><span>有效期{{couponParam.validatyBegin|strDate(3)}}至{{couponParam.validatyEnd|strDate(3)}}</span></li>
                        <li v-if="couponParam.disableDate"><span>{{couponParam.disableDate|businessDay}}不可以使用</span></li>
                        <li><span>使用时间：{{userTime}}</span></li>
                        <li v-if="couponParam.restricted"><span>满{{couponParam.restricted}}元可使用</span></li>
                    </ul>
                </div>
                <div class="coupon_dtl_instr2">
                    <ul>
                        <li v-if="diejia"><i class="iconfont icon-kediejiashiyong-"></i>可叠加使用{{couponParam.useNum}}张</li>
                        <li v-if="gongtong"><i class="iconfont icon-keyuqitadianziquangongtongshiyong-"></i>可与其他电子券同时使用</li>
                        <li><i class="iconfont icon-buzhaolingbuduixian-"></i>不找零不兑现</li>
                    </ul>
                </div>
            </div>

            <div v-if="!replyNum.couponComNum||replyNum.couponComNum==0" class="whiteBg mgt10 no_comment">暂无评论</div>
            <div v-if="replyNum.couponComNum>0" ref="commBox" class="whiteBg marTop" @click="hide">
                <div class="aboutComments">
                    <a @click="replyJump(couponDetail)">
                        <i class="icon iconfont icon-right right"></i>关于电子券的评论 ({{replyNum.couponComNum || 0}})
                    </a>
                </div>
                <div class="coupon_dtl_tag">
                    <p :class="indexCom==3?'tag_all':'tag_good'" @click="tabCom(3)">全部({{replyNum.couponComNum||0}})</p>
                    <p :class="indexCom==0?'tag_all':'tag_good'" @click="tabCom(0)">满意({{replyNum.couponComStar45Num||0}})</p>
                    <p :class="indexCom==1?'tag_all':'tag_good'" @click="tabCom(1)">一般({{replyNum.couponComStar3Num||0}})</p>
                    <p :class="indexCom==2?'tag_all':'tag_bad'" @click="tabCom(2)">不满意({{replyNum.couponComStar12Num||0}})</p>
                </div>
            </div>
            <comments v-show="replyNum.couponComNum>0" @clickPub="publishFocus" @clickBlur="hide" :commentList="couponComments" :replyStyle="indexTab" :mchtId="couponParam.mchtId"></comments>
            <a v-if="replyNum.couponComNum>0" @click="replyJump(couponDetail)" class="viewAllCom"><i class="icon iconfont icon-right right"></i>查看全部券友评论</a>
        </div>
        <!-- 关于商家的评论-->
        <div class="couponDtlTab1" v-show="indexTab == 1 ">
            <div class="whiteBg" @click="hide">
                <div class="merInfo">
                    <div class="card_name">
                        {{mcht.mchtSearch.name||mchtInfo.mchtName}}
                    </div>
                    <div class="coupon_info_item">
                        <p class="star_con">
                            <star :couponComScore="mcht.mchtSearch.mchtComScore"></star>
                        </p>
                        <span class="info_pad left">{{mcht.mchtSearch.mchtComNum||mchtInfo.mchtComNum||0}}条</span>
                    </div>
                    <div class="coupon_info_item">
                        <span  v-if="mcht.flag=='true'" class="right">{{mcht.mchtSearch.distance | setDistance}}</span>
                        <span class="right" style="margin-right: 0.5rem;">{{mcht.mchtSearch.mchtArea||mchtInfo.mchtArea}}</span>
                        <span class="red_color">￥{{mcht.mchtSearch.mchtPer||mchtInfo.mchtPer}}/人</span><span class="pad_l">{{mcht.mchtTypeValue}}</span>
                    </div>
                </div>
                <div class="mer_position">
                    <a :href="telephone" class="phoneBtn">
                        <i class="icon iconfont icon-dianhua-"></i>
                    </a>
                    <div @click="getPosition">
                        <i class="icon iconfont icon-location left"></i>
                        <p><span>{{mcht.mchtSearch.mchtAddr||mchtInfo.mchtAddr}}</span></p>
                    </div>
                </div>
                <div class="shop_timer">
                    <i class="icon iconfont icon-shijian- left"></i>
                    <p>
                        <span>{{mcht.mchtBusTime}}  {{mcht.mchtBusDay|businessDay}}</span><br/>
                        <span v-if="mcht.mchtBusDay2&&mcht.mchtBusTime2">{{mcht.mchtBusTime2}}  {{mcht.mchtBusDay2|businessDay}}</span>
                    </p>
                </div>
                <div class="shop_branch" @click="lookbranth(mchtInfo)" v-if="mcht.num>0">
                    <i class="icon iconfont icon-shanghu- left"></i>
                    <a class="icon iconfont icon-right right"></a>
                    <p>其他{{mcht.num||0}}家分店</p>
                </div>
            </div>

            <div v-if="!replyShopNum.mchtComNum||replyShopNum.mchtComNum==0" class="whiteBg mgt10 no_comment">暂无评论</div>
            <div v-if="replyShopNum.mchtComNum>0" ref="commBox" class="whiteBg marTop" @click="hide">
                <div class="aboutComments">
                    <a @click="replyShopJump(couponDetail)">
                        <i class="icon iconfont icon-right right"></i>关于商家的评论 ({{replyShopNum.mchtComNum||0}})
                    </a>
                </div>
                <div class="coupon_dtl_tag">
                    <p :class="indexCom==3?'tag_all':'tag_good'" @click="tabCom(3)">全部({{replyShopNum.mchtComNum||0}})</p>
                    <p :class="indexCom==0?'tag_all':'tag_good'" @click="tabCom(0)">满意({{replyShopNum.mchtComStar45Num||0}})</p>
                    <p :class="indexCom==2?'tag_all':'tag_bad'" @click="tabCom(2)">不满意({{replyShopNum.mchtComStar12Num||0}})</p>
                    <p :class="indexCom==1?'tag_all':'tag_good'" @click="tabCom(1)">一般({{replyShopNum.mchtComStar3Num||0}})</p>
                    <p :class="indexCom==4?'tag_all':'tag_good'" @click="tabCom(4)">有图({{replyShopNum.mchtPicNum||0}})</p>
                </div>
            </div>
            <comments v-show="replyShopNum.mchtComNum>0" @clickPub="publishFocus" @clickBlur="hide" :commentList="shopComments" :replyStyle="indexTab" :mchtId="couponParam.mchtId" :allStatus="allStatus"></comments>
            <a v-if="replyShopNum.mchtComNum>0" @click="replyShopJump(couponDetail)" class="viewAllCom"><i class="icon iconfont icon-right right"></i>查看全部券友评论</a>
        </div>
        <!-- 评论框 -->
        <div v-show="boxStatus" :class="!$route.query.type?'comment_box commet_fix':'comment_box'">
            <input id="inputId" ref="inputId" @focus="inputFixed" v-model="commentCont" class="left" type="text" placeholder="写点评论吧" />
            <span @click="publish()" class="comment_box_btn right">发表</span>
        </div>

        <div class="botSpace"></div>
        <div class="exchangeBtn" v-if="!$route.query.type">
            <!--<span><svg aria-hidden="true" class="icon"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-fenxiangyaoqingma"></use></svg></span>-->
            <span @click="collection">
                <svg v-show="!collectStatus" aria-hidden="true" class="icon">
                    <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-shoucang-"></use>
                </svg>
                <svg v-show="collectStatus" aria-hidden="true" class="icon color_ec">
                    <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-shoucangfuben"></use>
                </svg>
            </span>
            <a href="javascript:;" @click="exchange" class="mainBtn" :class="{'disBtn':!couponParam.usrId}">立即兑换</a>
        </div>
    </div>
</template>
<script>
    import header from '../../componentes/global/header.vue'
    import slideImg from '../../componentes/global/slideImg.vue'
    import comments from '../../componentes/global/comments.vue'
    import star from '../../componentes/global/star.vue'
    import couponNum from '../../componentes/global/couponNum.vue'
    import getData from '../../service/getData.js'
    import getData2 from '../../service/getData2.js'
    import getData4 from '../../service/getData4.js'
    import * as types from '../../vuex/types.js'
    import { mapState } from 'vuex'
    import { Toast,Indicator,MessageBox } from 'mint-ui'
    import {Storage} from 'src/utils/storage.js'

    export default {
        data(){
            return{
                indexTab:0,
                replyNum:'',
                replyShopNum:'',
                diejia:'',
                gongtong:'',
                userTime:'',
                mcht:{mchtSearch:{}},
                replyStyle:'',
                indexCom:3,
                commId:'',
                commentCont:'',
                boxStatus:false,
                picture:'',
                allStatus:true,
                collectStatus:false,
                collectIndex:'',
                param:{},
                couponParam:{},
                telephone:'',
                extra:'',
                banner:[],
                scpoe:"",
                mchtInfo:{}
            }
        },
        components: {
            'v-header': header,
            comments,star,couponNum
        },
        created:function(){
            this.$store.commit(types.SHOP_COMMENTS);//初始化列表
            this.$store.commit(types.COUPON_COMMENTS);//初始化列表
            this.$store.commit("COUPON_PAGES");//评论分页初始化
            //电子券详情
            let me = this;
            var route  = this.$route.query,
                store  = Storage.get("couponInfo");

            me.param = {
                couponId:store.couponId || route.c,
                  mchtId:store.mchtId.toString()         || route.m,
                   seqNo:store.id       || store.seqNo   || route.s     || '',
                   usrId:store.usrId    || store.sellUsr || route.u     || '',
                usrPicId:store.usrPicId || route.ui      || 0
            };
            // Indicator.open('加载中...');
            me.$store.commit('changeState', true)
            getData4.getDishType({mchtId:me.param.mchtId}).then(data =>{
                 var scpoeList = data.content.lowTypeNameList

                getData.getCouponInfo({"method":'post',data:{"couponId":me.param.couponId,"mchtId":me.param.mchtId,"seqNo":me.param.seqNo,"usrId":me.param.usrId, "usrPicId":me.param.usrPicId}}).then(rep => {
                    if (rep.respCode=='00') {
                        rep.content.couponId = me.param.couponId;
                        me.couponParam = rep.content;
                        if(rep.content){
                            me.$store.commit(types.HEAD_TEXT,rep.content.couponName);
                            me.diejia = rep.content.useRule.indexOf("M") >=0;
                            me.gongtong = rep.content.useRule.indexOf("D") >=0;
                            // me.userTime = rep.content.useTime.split(",").join(" ");
                            me.userTime = rep.content.useTime;
                            if(rep.content.scpoe.indexOf("T") >=0){
                                me.extra = "不可用"
                            }else{
                                me.extra = "可用"
                            }

                            //获取商户可用或非可用菜类列表
                            let scpoe = rep.content.scpoe.substr(1,rep.content.scpoe.length+1).split(",")
                            let type =[];
                            scpoe.find(data => {
                                scpoeList.forEach(value => {
                                    if(value.typeId == data){
                                        type.push(value.typeName);
                                    }
                                })
                                me.scpoe = type.join("、")
                            })
                        };
                    }else{
                        Toast({
                            message: rep.errorInfo,
                            duration: 800
                        });
                        // MessageBox.alert(rep.errorInfo).then(action => {
                        //     window.history.back();
                        // });
                    }
                })
            });
            //获取商户菜单类型

            //商户详情  || '121.47,31.23'
            var cityGet = Storage.get("city", true);
            if (me.position=='') {
                getData.mchtNo({mchtId:me.param.mchtId}).then(rep => {
                    me.mchtInfo= rep.content.mcht;
                    me.mcht.mchtTypeValue = rep.content.mchtTypeValue;
                    me.mcht.num = rep.content.num;
                    me.mcht.mchtBusTime = rep.content.mcht.mchtBusTime.replace(/\s+/g,"")
                    me.mcht.mchtBusDay = rep.content.mcht.mchtBusDay
                    me.telephone='tel:'+ rep.content.mcht.mchtTel1;
                    me.mcht.mchtBusDay2 = rep.content.mcht.mchtBusDay2
                    if (rep.content.mcht.mchtBusTime2) {
                        me.mcht.mchtBusTime2 = rep.content.mcht.mchtBusTime2.replace(/\s+/g,"")
                    }
                });
            }else{
                getData.mchtNew({method: 'post',data:{cityName:cityGet,position:me.position},mchtId:me.param.mchtId}).then(rep => {
                    me.mcht = rep.content;
                    me.mchtInfo = rep.content;
                    me.mchtInfo.mchtId=rep.content.mchtSearch.id;
                    me.mcht.mchtBusTime = me.mcht.mchtBusTime.replace(/\s+/g,"")
                    me.telephone='tel:'+ rep.content.mchtTel1;
                    if (me.mcht.mchtBusTime2) {
                       me.mcht.mchtBusTime2 = me.mcht.mchtBusTime2.replace(/\s+/g,"")
                    }
                });
            }
            // if (me.position=='') {
            //     getData.mchtNo({mchtId:me.param.mchtId}).then(rep => {
            //         me.mchtInfo= rep.content.mcht;
            //         me.mcht.mchtTypeValue = rep.content.mchtTypeValue;
            //         me.mcht.num = rep.content.num;
            //         me.mcht.mchtBusTime = rep.content.mcht.mchtBusTime.replace(/\s+/g,"")

            //         me.mcht.mchtBusDay = rep.content.mcht.mchtBusDay
            //         me.mcht.mchtBusDay2 = rep.content.mcht.mchtBusDay2
            //         me.telephone='tel:'+ rep.content.mcht.mchtTel1;
            //         me.mcht.mchtBusTime2 = rep.content.mcht.mchtBusTime2.replace(/\s+/g,"")
            //     });
            // }else{
            //     getData.mcht({position:me.position,mchtId:me.param.mchtId}).then(rep => {
            //         if (!rep.content.mchtSearch) {
            //             getData.mchtNo({mchtId:me.param.mchtId}).then(rep => {
            //                 me.mchtInfo= rep.content.mcht;
            //                 me.mcht.mchtTypeValue = rep.content.mchtTypeValue;
            //                 me.mcht.num = rep.content.num;
            //                 me.mcht.mchtBusTime = rep.content.mcht.mchtBusTime.replace(/\s+/g,"")
            //                 me.mcht.mchtBusDay = rep.content.mcht.mchtBusDay
            //                 me.telephone='tel:'+ rep.content.mcht.mchtTel1;
            //                 me.mcht.mchtBusDay2 = rep.content.mcht.mchtBusDay2
            //                 if (rep.content.mcht.mchtBusTime2) {
            //                     me.mcht.mchtBusTime2 = rep.content.mcht.mchtBusTime2.replace(/\s+/g,"")
            //                 }
            //             });
            //         } else {
            //             me.mcht = rep.content;
            //             me.mchtInfo = rep.content;
            //             me.mchtInfo.mchtId=rep.content.mchtSearch.id;
            //             me.mcht.mchtBusTime = me.mcht.mchtBusTime.replace(/\s+/g,"")
            //             me.telephone='tel:'+ rep.content.mchtTel1;
            //             if (me.mcht.mchtBusTime2) {
            //                me.mcht.mchtBusTime2 = me.mcht.mchtBusTime2.replace(/\s+/g,"")
            //             }
            //         }


            //     });
            // }


            //关于电子券评论列表
            this.couponList();
            //判断有无收藏
            this.isCollected();
            //商户广告
            this.shopBanner();
            //设置分享
//          wx.ready(function(){
//              var c = me.param.couponId,  //couponId
//                  m = me.param.mchtId,   //mchtId
//                  s = me.param.seqNo,   //seqNo
//                  u = me.param.usrId,   //usrId
//                  ui= me.param.usrPicId;//usrPicUrl
//                  if(s){
//                      var url = location.href + '?c='+c+'&m='+m+'&s='+s+'&u='+u+'&ui='+ui;
//                  }else{
//                      var url = location.href + '?c='+c+'&m='+m
//                  }
//              Common.wechatShare(
//                  {//分享到朋友圈
//                      title:'芸券',
//                      img:''
//                  },
//                  {//分享给朋友
//                      title:'芸券',
//                      des:'描述',
//                      img:''
//                  },
//                  url
//              );
//          });

        },
        computed:{
            ...mapState({
                userInfo:state => state.user.userInfo,
                couponInfo:state => state.coupon.couponInfo,
                couponComments:state => state.coupon.couponComments,
                shopComments:state => state.coupon.shopComments,
                couponDetail:state => state.coupon.couponDetail,
                setOwnerInfo:state => state.coupon.setOwnerInfo,
                position:state => state.coupon.position,//用户地理位置
            })
        },
        filters:{
            timeAnalysis:function(value) {
                if(!value){
                    return;
                }
                if (value.indexOf('null')>0) {
                    value=value.substring(0,value.indexOf(','));
                }
                return value
            }
        },
        methods:{
            tabSwitch:function(num){
                var me=this;
                this.indexTab = num;
                this.$store.commit(types.SHOP_COMMENTS);//初始化列表
                this.$store.commit(types.COUPON_COMMENTS);//初始化列表
                this.$store.commit("COUPON_PAGES");//评论分页初始化
                if (num==1) {
                    this.indexCom = 3;
                    //关于商户评论列表
                    this.shopList();
                }else if(num==0){
                    this.indexCom = 3;
                    //关于电子券评论列表
                    this.couponList();
                }
            },
            //关于电子券评论列表
            couponList:function(){
                var me=this;
                this.$store.dispatch("couponComments",{couponId:me.param.couponId,data:{"commStar": me.indexCom,"hasPic": "","mchtId":me.param.mchtId,}}).then(function(rep){
                        me.replyNum=rep.content;
                    })
            },
            //关于商户评论列表
            shopList:function(){
                var me=this;
                this.$store.dispatch("shopComments",{mchtId:me.param.mchtId,data:{"commStar": me.indexCom,"hasPic": me.picture,"mchtId":me.param.mchtId,}}).then(function(rep){
                        me.replyShopNum=rep.content;
                    })
            },
            // 评论满意度切换
            tabCom(num){
                this.$store.commit(types.SHOP_COMMENTS);//初始化列表
                this.$store.commit(types.COUPON_COMMENTS);//初始化列表
                this.$store.commit("COUPON_PAGES");//评论分页初始化
                this.indexCom = num;
                if (num==4) {
                    this.picture=3;
                }else{
                    this.picture='';
                }
                if (this.indexTab==0) {
                   this.couponList();
               }else if(this.indexTab==1){
                   this.shopList();
               }
               setTimeout(function(){
                    // window.scrollTo(0,divHeight);
                    me.$refs.commBox.scrollIntoView(true);
                },500)

            },
            //关于电子券的评论跳转
            replyJump:function(){
                var me=this;
                this.replyStyle=0;
                this.$router.push({'path':'/commentAll/'+me.param.mchtId+'/'+me.param.couponId+'/0'});
            },
            //关于商户的评论跳转
            replyShopJump:function(){
                var me=this;
                this.replyStyle=1;
                this.$router.push({'path':'/commentAll/'+me.param.mchtId+'/'+me.param.couponId+'/1'});
            },
            exchange:function(){

                this.$router.push({'name':'exchange'});

            },
            //查看商户所在位置
            getPosition:function(){
                let me = this;
                var po_array = me.mcht.mchtSearch.position.split(" ");
                wx.openLocation({
                    latitude:parseFloat(po_array[1]), // 纬度，浮点数，范围为90 ~ -90
                    longitude:parseFloat(po_array[0]), // 经度，浮点数，范围为180 ~ -180。
                    name: me.mcht.mchtSearch.name||me.mchtInfo.mchtName, // 位置名
                    address: '', // 地址详情说明
                    scale: 12, // 地图缩放级别,整形值,范围从1~28。默认为最大
                    infoUrl: '' // 在查看位置界面底部显示的超链接,可点击跳转
                });
            },
            //点评论聚焦
            publishFocus:function(data){
                this.commId=data.commId;
                this.commentUsrd=data.usrId;
                this.boxStatus=true;
                document.getElementById('inputId').focus();
            },
            // 点评论失焦
            hide:function(){
                this.boxStatus=false
            },
            // input聚焦
            inputFixed:function(){
                let me=this;
                let inputEl=me.$refs.inputId;
                setTimeout(function(){
                    inputEl.scrollIntoView(true);
                },100)
                if(/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)){
                    setTimeout(function(){
                        console.log(document.body.scrollHeight)
                        window.scrollTo(0,document.body.scrollHeight);
                    },500)
                }
            },
            //发表
            publish:function(e){
                var me=this;
                if (me.commentCont=='') {
                    Toast({
                        message: '内容不能为空',
                        duration: 800
                    });
                    return false;
                }
                if (me.commentUsrd==me.userInfo.usrId) {
                    Toast({
                        message: '不能回复自己',
                        duration: 800
                    });
                    return;
                }
                var baseComm=Base64.encode(me.commentCont);
                getData2.commentReply({'method':'post',data:{commId:me.commId,dsc:baseComm}},me.userInfo.usrId).then(rep=>{
                    if(rep.respCode == '00'){
                        Toast({
                            message: '回复成功',
                            duration: 800
                        });
                        me.commentCont=''
                        me.boxStatus=false;
                        if (me.indexTab==0) {
                            me.$store.commit("COUPON_PAGES");
                           me.couponList();
                        }else if(me.indexTab==1){
                            me.$store.commit("COUPON_PAGES");
                           me.shopList();
                        }

                    }else{
                        Toast({
                            message: '回复失败',
                            duration: 800
                        });
                        me.boxStatus=false;
                    }
                })
            },
            // 查看其他分店
            lookbranth:function(info){
                console.log(info.upperMchtId);
                console.log(info.mchtId);
                this.$router.push({'path':'/businessOther/' + info.mchtId + '/' + info.upperMchtId})
            },
            //判断有无收藏
            isCollected:function(){
                var me=this;
                var collectStorage ={
                    collectList:[],
                    listId:[],
                    usrId:''
                };
                var collectArry = Storage.get("collect_info");
                // var couponCont = Storage.get("couponInfo");
                // console.log(collectArry);

                if(collectArry){

                    if (me.param.seqNo) {

                        for (var i = 0; i < collectArry.listId.length; i++) {
                            if (me.param.seqNo==collectArry.listId[i]) {

                                me.collectStatus=true;
                                me.collectIndex=i;
                                return;
                            }
                        }

                        me.collectStatus=false;
                    }else if(me.param.couponId){
                        var mosaic=me.param.mchtId+','+me.param.couponId;
                        for (var i = 0; i < collectArry.listId.length; i++) {
                            if (mosaic==collectArry.listId[i]) {
                                me.collectStatus=true;
                                me.collectIndex=i;
                                return;
                            }
                        }
                        me.collectStatus=false;
                    }
                    // }else{
                    //     console.log(33333);

                    //     for (var i = 0; i < collectArry.listId.length; i++) {
                    //         if (me.couponCont.mchtIds==collectArry.listId[i]) {
                    //             me.collectStatus=true;
                    //             me.collectIndex=i;
                    //             return;
                    //         }
                    //     }
                    //     me.collectStatus=false;
                    // }
                }else{
                    me.collectStatus=false;
                }

            },
            // 收藏
            collection:function(){
                let me = this;
                var collectArry = Storage.get("collect_info") || {collectList:[],listId:[],usrId:''};
                if(!collectArry.usrId){
                    collectArry.usrId=me.userInfo.usrId;
                }
                if (!this.collectStatus){
                    this.collectStatus=true;
                    Toast({
                      message: '收藏成功',
                      duration: 800
                    });

                    collectArry.collectList.unshift(me.couponParam);
                    if (me.param.seqNo) {
                        collectArry.listId.unshift(me.couponParam.seqNo);
                    }else{
                        var mosaic=me.couponParam.mchtId+','+me.couponParam.couponId;
                        collectArry.listId.unshift(mosaic);
                    }
                    Storage.set("collect_info",collectArry)
                }else{
                    this.collectStatus=false;
                    Toast({
                      message: '取消收藏',
                      duration: 800
                    });
                    // console.info(me.collectIndex);
                    collectArry.collectList.splice(me.collectIndex,1)
                    collectArry.listId.splice(me.collectIndex,1)
                    Storage.set("collect_info",collectArry)
                }
            },
            //商户广告
            shopBanner:function(){
                var me=this;
                // console.log(me.param)
                getData2.shopBanner({method:'post',data:{"aoData": "","mchtId": me.param.mchtId,"state": ""}}).then(function(rep){
                    // console.log(1111)
                    me.banner=rep.content.list;
                })
            }
            /**
             * 获取信息
             */
        }
    }
</script>
<style scoped>
    .mer_position p{display: flex;}
    .mer_position p span{max-height: 2.4rem;display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 2;overflow: hidden;}
    .card_info .card_name{width: -webkit-calc(100% - 3rem);width:calc(100% - 3rem);overflow: hidden;text-overflow:ellipsis;white-space: nowrap;}
    .info_pad{
        line-height: 1.5rem;
        height: 1.4rem;
    }
</style>
